package com.inei.eea2014.tools;

import com.inei.eea2014.R;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public class Mensaje {

	Toast toast;
	Context context;
	LayoutInflater inflater;
	View view;

	public Mensaje(Context context) {
		this.context = context;
		inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		toast = new Toast(context);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.setGravity(Gravity.CENTER, 0, 0);

	}

	public void Error(String msj) {
		view = inflater.inflate(R.layout.mensaje_error, null);
		TextView tv = (TextView) view.findViewById(R.id.tvMensaje);
		tv.setText(msj);
		toast.setView(view);
		toast.show();

	}

	public void Exito(String msj) {
		view = inflater.inflate(R.layout.mensaje_exito, null);
		TextView tv = (TextView) view.findViewById(R.id.tvMensaje);
		tv.setText(msj);
		toast.setView(view);
		toast.show();
	}
}
